﻿<%@ Page Language="C#" MasterPageFile="Module.master" AutoEventWireup="true" CodeFile="Module.aspx.cs"
    Inherits="Modules_Module" Title="Module" %>

<%@ Register Assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxDataView" TagPrefix="dxdv" %>
<asp:Content ID="Content1" ContentPlaceHolderID="content" runat="Server">
    <wilson:DataSource ID="dsLogEvent" runat="server" ObjectSpace="Touchmax.Manager.ORManager"
        TypeName="Touchmax.LogEvent" KeyMember="Oid" FilterExpression="1=1" />
    <wilson:DataSource ID="dsCall" runat="server" ObjectSpace="Touchmax.Manager.ORManager"
        TypeName="Touchmax.OpActivity" KeyMember="ActivityID" FilterExpression="1=1" />
    <wilson:DataSource ID="dsOrder" runat="server" ObjectSpace="Touchmax.Manager.ORManager"
        TypeName="Touchmax.OpOrder" KeyMember="Oid" FilterExpression="JobStatus<>'Completed'" />
    <wilson:DataSource ID="dsEvent" runat="server" ObjectSpace="Touchmax.Manager.ORManager"
        TypeName="Touchmax.LogEvent" KeyMember="Oid" FilterExpression="1=1" />
    <wilson:DataSource ID="dsTask" runat="server" ObjectSpace="Touchmax.Manager.ORManager"
        TypeName="Touchmax.TaskManagement" KeyMember="Oid" FilterExpression="1=1" />
        <br />
    <table width="800" cellspacing=10>
        <tr>
            <td align="left" valign="top" width="400">

            <div style="border:solid 2px #BBBBBB;margin-top:10px;min-height:200px;">
            
           <table width="100%"  cellspacing=0 cellpadding=0><tr>
                        <td style="background-color:#A1A1A1;padding:6px;font-weight:bold">
                        Announcements
                        </td>
                        <td style="background-color:#A1A1A1;padding:6px;" align="right">
                            [ <a style="text-decoration:none;font-size:14px;" href='javascript:grd_Log.AddNewRow()'> + </a> ]
                            </td>
                    </tr>
                    <tr>
                        <td colspan=2>
                            <dxwgv:ASPxGridView ID="grd_Log" ClientInstanceName="grd_Log" runat="server" DataSourceID="dsLogEvent"
                                KeyFieldName="Oid" Width="100%" OnInit="grd_Log_Init" OnInitNewRow="grd_Log_InitNewRow"
                                OnRowInserting="grd_Log_RowInserting">
                                <SettingsBehavior ConfirmDelete="True" />
                                <SettingsPager Mode="ShowAllRecords">
                                </SettingsPager>
                                <SettingsEditing Mode="PopupEditForm" PopupEditFormWidth="400" />
                                <Settings ShowColumnHeaders="false" ShowVerticalScrollBar="false" VerticalScrollBarStyle="Virtual" VerticalScrollableHeight="200" />
                                <Columns>
                                    <dxwgv:GridViewCommandColumn VisibleIndex="0" Width="8%">
                                        <EditButton Text="Edit" Visible="True" />
                                    </dxwgv:GridViewCommandColumn>
                                 
                                    <%-- <dxwgv:GridViewDataColumn FieldName="UserId" ReadOnly="true" Caption="User" VisibleIndex="1" Width="40">
                                                                </dxwgv:GridViewDataColumn>
                                                                <dxwgv:GridViewDataColumn FieldName="EntryDate" ReadOnly="true" Caption="Date" VisibleIndex="1" Width="80" >
                                                                </dxwgv:GridViewDataColumn>--%>
                                    <dxwgv:GridViewDataColumn FieldName="Description" Caption="Description" VisibleIndex="1"
                                        Width="80%">
                                    </dxwgv:GridViewDataColumn>
                                </Columns>
                                <Templates>
                                    <EditForm>
                                        <dxe:ASPxMemo ID="memo" runat="server" Width="100%" Text='<%# Bind("Description") %>'>
                                        </dxe:ASPxMemo>
                                        <table>
                                            <tr>
                                                <td align="right" width="100">
                                                    <dxe:ASPxButton ID="btn_Save" Width="80" runat="server" Text="Save" AutoPostBack="false">
                                                        <ClientSideEvents Click="function(s,e){
                                grd_Log.UpdateEdit();
                                }" />
                                                    </dxe:ASPxButton>
                                                </td>
                                                <td align="right" width="100">
                                                    <dxe:ASPxButton ID="ASPxButton2" Width="80" runat="server" Text="Cancel" AutoPostBack="false">
                                                        <ClientSideEvents Click="function(s,e){
                                grd_Log.CancelEdit();
                                }" />
                                                    </dxe:ASPxButton>
                                                </td>
                                            </tr>
                                        </table>
                                    </EditForm>
                                </Templates>
                            </dxwgv:ASPxGridView>
                        </td>
                    </tr>
                </table>

            </div>
            
                <div style="border:solid 2px #BBBBBB;margin-top:10px;min-height:200px;">
            
           <table width="100%"  cellspacing=0 cellpadding=0><tr>
                        <td style="background-color:#A1A1A1;padding:6px;font-weight:bold">
                        Schedule List
                        </td>
                        <td style="background-color:#A1A1A1;padding:6px;" align="right">
                            [ <a style="text-decoration:none;font-size:14px;" href='javascript:grd_Log.AddNewRow()'> + </a> ]
                            </td>
                    </tr>
                    <tr>
                        <td colspan=2>
                           
                           <table cellspacing=4 cellpadding=4 style="font-size:15px;font-family:Verdana;" class="dashboard">
                <%
                    Wilson.ORMapper.ObjectSpace engine0 = Touchmax.Manager.ORManager as Wilson.ORMapper.ObjectSpace;
                    Wilson.ORMapper.ObjectQuery oq0 = new Wilson.ORMapper.ObjectQuery(typeof(Touchmax.OpActivity), "", "AppointmentDate");
                    Wilson.ORMapper.ObjectSet os0 = engine0.GetObjectSet(oq0);
                    for(int i=0; i< os0.Count; i++)
                    {
                        Touchmax.OpActivity u = os0[i] as Touchmax.OpActivity;
                        Response.Write("<tr><td colspan=3>"+u.AppointmentDate.ToString("dddd, MMM dd, yyyy")+"</td></tr>");
                        string v1 = string.Format("<tr><td width=100>{0} - {1}</td><td>Customer: {2}</td></tr>", u.Time1, u.Time2, u.CustName);
                        string v2 = string.Format("<tr><td>&nbsp;</td><td>Technician: {0}</td></tr>", GetEmployeeCode(u.TechID));
                        Response.Write(v1);
                        Response.Write(v2);
                    }
                    
                    
                     %>
                     </table>

                        </td>
                    </tr>
                </table>

            </div>

            </td>
            <td align="right" valign="top" width="400">
   
    <div style="border:solid 2px #BBBBBB;margin-top:10px;min-height:300px;">
            
           <table width="100%"  cellspacing=0 cellpadding=0><tr>
                        <td style="background-color:#A1A1A1;padding:6px;font-weight:bold">
                        Service Orders
                        </td>
                        <td style="background-color:#A1A1A1;padding:6px;" align="right">
               
                            </td>
                    </tr>
            <tr><td colspan=2>
                <table cellspacing=4 cellpadding=4 style="font-size:15px;font-family:Verdana;" class="dashboard">
                <%
                    Wilson.ORMapper.ObjectSpace engine = Touchmax.Manager.ORManager as Wilson.ORMapper.ObjectSpace;
                    Wilson.ORMapper.ObjectQuery oq = new Wilson.ORMapper.ObjectQuery(typeof(Touchmax.OpOrder), "JobStatus='Pending'", "JobDate");
                    Wilson.ORMapper.ObjectSet os = engine.GetObjectSet(oq);
                    Response.Write("<tr><td colspan=3>Pending</td></tr>");
                    for(int i=0; i< os.Count; i++)
                    {
                        Touchmax.OpOrder u = os[i] as Touchmax.OpOrder;
                        string v = string.Format("<tr><td>{0}</td><td>{1:dd/MM/yyyy}</td><td>{2}</td></tr>",u.JobNo ,u.JobDate,u.CustName);
                        Response.Write(v);
                    }
                    
                    
                     %>
                     </table>
                <table cellspacing=4 cellpadding=4 style="font-size:15px;font-family:Verdana;" class="dashboard">
                <%
                    Wilson.ORMapper.ObjectSpace engine2 = Touchmax.Manager.ORManager as Wilson.ORMapper.ObjectSpace;
                    Wilson.ORMapper.ObjectQuery oq2 = new Wilson.ORMapper.ObjectQuery(typeof(Touchmax.OpOrder), "JobStatus='Started'", "JobDate");
                    Wilson.ORMapper.ObjectSet os2 = engine.GetObjectSet(oq2);
                    Response.Write("<tr><td colspan=3>Started</td></tr>");
                    for(int i=0; i< os2.Count; i++)
                    {
                        Touchmax.OpOrder u = os2[i] as Touchmax.OpOrder;
                        string v = string.Format("<tr><td>{0}</td><td>{1:dd/MM/yyyy}</td><td>{2}</td></tr>",u.JobNo ,u.JobDate,u.CustName);
                        Response.Write(v);
                    }
                    
                    
                     %>
                     </table>
                
                     </td>
                     </tr>

                </table>
                </div>
                </td>
        </tr>
    </table>
</asp:Content>
